/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.baladaboa.ws.core;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Leone
 */
@Entity
@Table(name = "ponto_onibus", catalog = "dbbaladaboa", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PontoOnibus.findAll", query = "SELECT p FROM PontoOnibus p"),
    @NamedQuery(name = "PontoOnibus.findByIdpontoOnibus", query = "SELECT p FROM PontoOnibus p WHERE p.idpontoOnibus = :idpontoOnibus"),
    @NamedQuery(name = "PontoOnibus.findByLinha", query = "SELECT p FROM PontoOnibus p WHERE p.linha = :linha"),
    @NamedQuery(name = "PontoOnibus.findByReferencia", query = "SELECT p FROM PontoOnibus p WHERE p.referencia = :referencia")})
public class PontoOnibus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idponto_onibus", nullable = false)
    private Integer idpontoOnibus;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 8)
    @Column(name = "linha", nullable = false, length = 8)
    private String linha;
    @Size(max = 100)
    @Column(name = "referencia", length = 100)
    private String referencia;
    @JoinColumn(name = "endereco_idendereco", referencedColumnName = "idendereco", nullable = false)
    @ManyToOne(optional = false)
    private Endereco enderecoIdendereco;
    @JoinColumn(name = "casa_idcasa", referencedColumnName = "idcasa", nullable = false)
    @ManyToOne(optional = false)
    private Casa casaIdcasa;

    public PontoOnibus() {
    }

    public PontoOnibus(Integer idpontoOnibus) {
        this.idpontoOnibus = idpontoOnibus;
    }

    public PontoOnibus(Integer idpontoOnibus, String linha) {
        this.idpontoOnibus = idpontoOnibus;
        this.linha = linha;
    }

    public Integer getIdpontoOnibus() {
        return idpontoOnibus;
    }

    public void setIdpontoOnibus(Integer idpontoOnibus) {
        this.idpontoOnibus = idpontoOnibus;
    }

    public String getLinha() {
        return linha;
    }

    public void setLinha(String linha) {
        this.linha = linha;
    }

    public String getReferencia() {
        return referencia;
    }

    public void setReferencia(String referencia) {
        this.referencia = referencia;
    }

    public Endereco getEnderecoIdendereco() {
        return enderecoIdendereco;
    }

    public void setEnderecoIdendereco(Endereco enderecoIdendereco) {
        this.enderecoIdendereco = enderecoIdendereco;
    }

    public Casa getCasaIdcasa() {
        return casaIdcasa;
    }

    public void setCasaIdcasa(Casa casaIdcasa) {
        this.casaIdcasa = casaIdcasa;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpontoOnibus != null ? idpontoOnibus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PontoOnibus)) {
            return false;
        }
        PontoOnibus other = (PontoOnibus) object;
        if ((this.idpontoOnibus == null && other.idpontoOnibus != null) || (this.idpontoOnibus != null && !this.idpontoOnibus.equals(other.idpontoOnibus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.baladaboa.ws.core.PontoOnibus[ idpontoOnibus=" + idpontoOnibus + " ]";
    }
    
}
